/* 
 * @description: 添加血脂
 * @author: Jane 
 * @date: 2023-09-20 15:02:54
 */
import 'package:basic_common/app_theme.dart';
import 'package:basic_common/common_exports.dart';
import 'package:basic_widgets/button_widget.dart';
import 'package:basic_widgets/input_widget.dart';
import '../../service_detail_controller.dart';
class AddFatDialog extends GetView<ServerDetailController> {
   List<Widget> fatCellEdits;
   AddFatDialog({required this.fatCellEdits});
  @override
  Widget build(BuildContext context) {
    return SimpleDialog(
      title: const Align(
        alignment: Alignment.topCenter,
        child: Text("添加血脂"),
      ),
      children: [
        //这边自己定义widget内容
        Center(
          child: Container(
            width: ScreenHelper.screenWidth,
            // margin: const EdgeInsets.symmetric(horizontal: 4),
            padding: EdgeInsets.all(ScreenHelper.width(6)),
            child: ListView(
              children: fatCellEdits,
              shrinkWrap: true,
            ),
          ),
        ),
        SizedBox(
          height: ScreenHelper.height(15),
        ),
        Container(
          margin: EdgeInsets.symmetric(horizontal: 10),
          child: Row(
            children: [
              Expanded(
                  child: roundBtn(
                      onTap: () {
                        Get.back();
                      },
                      text: "取消",
                      bgColor: Colors.white,
                      textColor: AppTheme.primyColor,
                      borderColor: AppTheme.primyColor)),
              SizedBox(
                width: ScreenHelper.width(10),
              ),
              Expanded(
                  child: roundBtn(
                      onTap: () {
                        Get.back();
                        controller.addFatData(
                            evaValue: controller.fatelaInputController.text);
                      },
                      text: "添加",
                      bgColor: AppTheme.primyColor,
                      textColor: Colors.white)),
            ],
          ),
        )
      ],
    );
  }

  /// 评估内容
  Widget buildEstimateWidget() {
    return Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        SizedBox(
          width: ScreenHelper.width(40),
          child: const Text(
            "评估",
            textAlign: TextAlign.left,
            style: TextStyle(color: AppTheme.dartWeakTextColor),
          ),
        ),
        Expanded(
          child: Container(
            alignment: Alignment.topCenter,
            child: mutileTextField(
                hintText: "请输入评估内容",
                textController: controller.fatelaInputController,
                countNum: "",
                minLines: 2),
          ),
        ),
      ],
    );
  }

  /// item
  Widget buildAddItem(
      {required String name,
      required String unit,
      required TextEditingController inputController}) {
    return SizedBox(
      height: ScreenHelper.height(60),
      child: Row(
        children: [
          SizedBox(
            width: ScreenHelper.width(60),
            child: Text(
              name,
              textAlign: TextAlign.left,
              style: TextStyle(color: AppTheme.dartWeakTextColor),
            ),
          ),
          Expanded(
              child: inputBox(hintText: '', inputController: inputController)),
          SizedBox(
            width: ScreenHelper.width(6),
          ),
          Text(
            '${unit}',
            style: TextStyle(color: AppTheme.dartWeakTextColor),
          ),
        ],
      ),
    );
  }
}
